<%--
  Created by IntelliJ IDEA.
  User: 拯救者
  Date: 2024/10/11
  Time: 19:52
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html>
<head>
    <title>学生列表</title>
    <link rel="stylesheet" href="/static/layui/css/layui.css">
    <style>

    </style>
</head>
<body>
<div class="layui-container">
    <form  method="post" action="/student/list/1">
        <div class="layui-form-item">
            <div class="layui-input-inline layui-input-wrap">
                <input type="text" name="studentNum" value="${condition.studentNum}" placeholder="请输入学号" autocomplete="off" class="layui-input">
            </div>
            <div class="layui-input-inline layui-input-wrap">
                <input type="text" name="studentName" value="${condition.studentName}" placeholder="请输入姓名" autocomplete="off" class="layui-input">
            </div>
            <div class="layui-input-inline">
                <button class="layui-btn" lay-submit lay-filter="formDemo">查询</button>
                <a class="layui-btn" href="/student/toadd" >新增学生</a>
            </div>
        </div>
    </form>

    <table class="layui-table">
        <colgroup>
            <col width="150">
            <col width="150">
            <col>
            <col>
        </colgroup>
        <thead>
        <tr>
            <th>编号</th>
            <th>学号</th>
            <th>姓名</th>
            <th>性别</th>
            <th>年龄</th>
            <th>出生日期</th>
            <th>班级编号</th>
            <th>宿舍编号</th>
            <th>联系电话</th>
            <th>电子邮件</th>
            <th>家庭住址</th>
            <th>紧急联系人</th>
            <th>紧急联系人电话</th>
            <th>专业</th>
            <th>学生状态</th>
            <th>删除状态</th>
            <th>创建者</th>
            <th>创建时间</th>
            <th>更新者</th>
            <th>更新时间</th>
            <th>备注</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        <c:forEach items="${students}" var="student">
            <tr>
                <td>${student.sId}</td>
                <td>${student.studentNum}</td>
                <td>${student.studentName}</td>
                <td>
                    <c:choose>
                        <c:when test="${student.gender eq '0'}">男</c:when>
                        <c:when test="${student.gender eq '1'}">女</c:when>
                        <c:otherwise>保密</c:otherwise>
                    </c:choose>
                </td>
                <td>${student.age}</td>
                <td><fmt:formatDate value="${student.birthday}" pattern="yyyy-MM-dd"/></td>
                <td>${student.classId}</td>
                <td>${student.hostelId}</td>
                <td>${student.phone}</td>
                <td>${student.email}</td>
                <td>${student.homeAddress}</td>
                <td>${student.emergencyContact}</td>
                <td>${student.emergencyContactPhone}</td>
                <td>${student.major}</td>
                <td>
                    <c:choose>
                        <c:when test="${student.status eq '0'}">在读</c:when>
                        <c:when test="${student.status eq '1'}">毕业</c:when>
                        <c:otherwise>未知</c:otherwise>
                    </c:choose>
                </td>
                <td>
                    <c:choose>
                        <c:when test="${student.delFlag eq '0'}">存在</c:when>
                        <c:when test="${student.delFlag eq '1'}">删除</c:when>
                        <c:otherwise>未记录</c:otherwise>
                    </c:choose>
                </td>
                <td>${student.createBy}</td>
                <td><fmt:formatDate value="${student.createTime}" pattern="yyyy-MM-dd"/></td>
                <td>${student.updateBy}</td>
                <td><fmt:formatDate value="${student.updateTime}" pattern="yyyy-MM-dd"/></td>
                <td>${student.remark}</td>
                <td>
                    <a class="layui-btn layui-bg-blue" href="/student/toupdate/${student.sId}">编辑</a>
                    <a class="layui-btn layui-bg-red" href="/student/delete/${student.sId}">删除</a>
                </td>
            </tr>
        </c:forEach>
        </tbody>
    </table>

    <table class="layui-table">
        <tr>
            <td colspan="4">
            <a href="/student/list/1">首页</a>
            <c:if test="${page.currentPage!=1}">
                <a href="/student/list/${page.currentPage-1}">上一页</a>
            </c:if>
            第${page.currentPage}页/共${page.totalPage}页
            <c:if test="${page.currentPage!=page.totalPage}">
                <a href="/student/list/${page.currentPage+1}">下一页</a>
            </c:if>
            <a href="/student/list/${page.totalPage}">尾页</a>
            </td>
        </tr>
    </table>

    <script src="/static/layui/layui.js"></script>
</div>
</body>
</html>
